package ex02.pyrmont.servlet;

import java.io.IOException;

import ex01.pyrmont.Request;
import ex01.pyrmont.Response;
import ex02.pyrmont.Servlet;
import ex02.pyrmont.ServletConfig;

public class PrimitiveServlet implements Servlet {

	private ServletConfig config;
	@Override
	public void init(ServletConfig config) {
		this.config = config;
		System.out.println("servelt init");
	}

	@Override
	public void service(Request request, Response response) {
		
		System.out.println("call servelt service");
//		PrintWriter writer = response.getWriter();
		try {
			response.getWriter().write("Hello red roses !".getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void destroy() {
		
		System.out.println("servelt destroy");
	}

	@Override
	public ServletConfig getServletConfig() {
		
		return config;
	}

	@Override
	public String getServletInfo() {
		
		return null;
	}

}
